package com.hzjq.core.convert

import com.hzjq.core.bean.CapEntity
import com.hzjq.core.loader.OnCapUidConvertLoader

class StandardsCapUidConvertor : OnCapUidConvertLoader {

    override fun convert(cap: CapEntity): String {
        if(cap.uid.isNotEmpty() && cap.uid.length > 2) {
            return cap.uid.substring(0, cap.uid.length - 2)
        }
        return cap.uid
    }


    /**
     * 不需要转换，uid值不变
     */
    override fun restore(cap: CapEntity): String {
        return cap.uid
    }
}